home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / CodeWarrior Lite / Metrowerks C⁄C++ Lite / Headers / ANSI Headers / string.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-25  |  3.1 KB  |  114 lines  |  [TEXT/MMCC]

  1. /* string.h standard header */
  2. #ifndef _STRING
  3. #define _STRING
  4. #ifndef _YVALS
  5. #include <yvals.h>
  6. #endif
  7.  
  8. #if __MWERKS__
  9. #pragma options align=mac68k
  10. #endif
  11.  
  12.         /* macros */
  13. #ifndef NULL
  14. #define NULL    _NULL
  15. #endif
  16.         /* type definitions */
  17. #ifndef _SIZET
  18. #define _SIZET
  19. typedef _Sizet size_t;
  20. #endif
  21.         /* declarations */
  22. _C_LIB_DECL
  23. int memcmp(const void *, const void *, size_t);
  24. void *memcpy(void *, const void *, size_t);
  25. void *memmove(void *, const void *, size_t);
  26. void *memset(void *, int, size_t);
  27. char *strcat(char *, const char *);
  28. int strcmp(const char *, const char *);
  29. int strcoll(const char *, const char *);
  30. char *strcpy(char *, const char *);
  31. size_t strcspn(const char *, const char *);
  32. char *strerror(int);
  33. size_t strlen(const char *);
  34. char *strncat(char *, const char *, size_t);
  35. int strncmp(const char *, const char *, size_t);
  36. char *strncpy(char *, const char *, size_t);
  37. size_t strspn(const char *, const char *);
  38. char *strtok(char *, const char *);
  39. size_t strxfrm(char *, const char *, size_t);
  40. char *_Strerror(int, char *);
  41. _END_C_LIB_DECL
  42.  
  43. #ifdef __MWERKS__
  44.         /* externally set this to 1 in order to force the ANSI calls */
  45. #ifndef _NO_FAST_STRING_INLINES_
  46. #define _NO_FAST_STRING_INLINES_ 0
  47. #endif
  48. #if !defined(powerc) && !_NO_FAST_STRING_INLINES_
  49.         /* use 680x0 assembler inlines for these routines */
  50. _C_LIB_DECL
  51. size_t __strlen(const char *:__A0):__D0 =
  52. { 0x70FF,0x5280,0x4A18,0x66FA };
  53. char *__strcpy(char *:__A0,const char *:__A1):__D0 =
  54. { 0x2008,0x10D9,0x66FC };
  55. char *__memcpy(void *:__A0,const void *:__A1,size_t:__D1):__D0 =
  56. { 0x2008,0x4A81,0x6706,0x10D9,0x5381,0x66FA };
  57. _END_C_LIB_DECL
  58.         /* macro overrides, for C */
  59. #define strlen(x)        __strlen(x)
  60. #define strcpy(x,y)        __strcpy((x),(y))
  61. #define memcpy(x,y,z)    __memcpy((x),(y),(z))
  62. #endif
  63. #endif
  64.  
  65. #ifdef __cplusplus
  66.         /* inlines and overloads, for C++ */
  67. #define _Const_return const
  68. _C_LIB_DECL
  69. void *memchr(const void *, int, size_t);
  70. char *strchr(const char *, int);
  71. char *strpbrk(const char *, const char *);
  72. char *strrchr(const char *, int);
  73. char *strstr(const char *, const char *);
  74. _END_C_LIB_DECL
  75. inline void *memchr(void *s, int c, size_t n)
  76.     {return (void *)memchr((const void *)s, c, n);}
  77. inline char *strchr(char *s, int c)
  78.     {return (char *)strchr((const char *)s, c);}
  79. inline char *strpbrk(char *s, const char *p)
  80.     {return (char *)strpbrk((const char *)s, p);}
  81. inline char *strrchr(char *s, int c)
  82.     {return (char *)strrchr((const char *)s, c);}
  83. inline char *strstr(char *s, const char *p)
  84.     {return (char *)strstr((const char *)s, p);}
  85. inline char *strerror(int _Err)
  86.     {return _Strerror(_Err, 0); }
  87. #else
  88. #define _Const_return
  89. void *memchr(const void *, int, size_t);
  90. char *strchr(const char *, int);
  91. char *strpbrk(const char *, const char *);
  92. char *strrchr(const char *, int);
  93. char *strstr(const char *, const char *);
  94.         /* macro overrides, for C */
  95. #define strerror(err)    _Strerror(err, 0)
  96. #endif
  97.  
  98. #if __MWERKS__
  99. #pragma options align=reset
  100. #endif
  101.  
  102. #endif
  103.  
  104.  
  105. /*
  106.  * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  107.  * Consult your license regarding permissions and restrictions.
  108.  */
  109.  
  110. /* Change log:
  111.  *94June04 PlumHall baseline
  112.  *94Oct07 Inserted MW changes.
  113.  */
  114.